#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   ListView.py
@Time    :   2020/07/15 10:05:04
@Author  :   Xiong qiufeng
@Version :   1.0
@Contact :   1528399071@qq.com
@License :   (C)Copyright 2017-2018, Liugroup-NLPR-CASIA
@Desc    :   None
'''


from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *

from .DeviceItemWidget import DeviceItemWidget

class DeviceGridWidget(QGridLayout):
    select_row = 0

    def __init__(self, parent=None):
        super(QGridLayout, self).__init__(parent)
        self.load()

    def handleItemClicked(self, item):
        self.select_row = item.row()

    def load(self, items):
        # self.clear()
        # self.setRowCount(len(items))
        # self.setHorizontalHeaderLabels(['名称', '位置', '型号', 'sn', '状态'])
        # self.btn_delete_list = {}
        # self.btn_modify_list = {}
        for i in range(0,len(items)):
            item = items[i]
            label_image = None
            icon = None
            if item['model'] == 'FSC-01':
                label_image = QLabel(self, pixmap=QPixmap(':icons/images/guangji.png'))
            if item['model'] == 'FSC-02':
                label_image = QLabel(self, pixmap=QPixmap(':icons/images/men.png'))
            if item['model'] == 'FSC-03':
                label_image = QLabel(self, pixmap=QPixmap(':icons/images/hongwai.png'))
            if item['model'] == 'FSC-04':
                label_image = QLabel(self, pixmap=QPixmap(':icons/images/fusheyuan.png'))
            if item['model'] == 'FSC-05':
                label_image = QLabel(self, pixmap=QPixmap(':icons/images/guidao.png'))
            self.addWidget(label_image, i//3,i%3,1,1)
            

